// 2010 Recoding

global keepers2010 ""

numlabel, add force

genl id=cserial
global keepers2010 $keepers2010 id

genl year=2010
global keepers2010 $keepers2010 year

genl wt=postwgt
global keepers2010 $keepers2010 wt

genl income=zq96
genl income3=income
centile income, c(33 66 100)
replace income3=0 if income<=r(c_1)
centile income, c(33 66 100)
replace income3=1 if income>r(c_1) & income<=r(c_2)
centile income, c(33 66 100)
replace income3=2 if income>r(c_2) & income<=r(c_3)
global keepers2010 $keepers2010 income3

genl pid_ce=bq9_1
recode pid_ce 2=1 -2/1 3/11=0
global keepers2010 $keepers2010 pid_ce

genl turnout=bq12_1
recode turnout -2 -1 2=0
global keepers2010 $keepers2010 turnout

genl vote_ce=bq12_2
recode vote_ce -2 -1 2/9 =0
global keepers2010 $keepers2010 vote_ce


// Campaign Interest

codebook bq10
gen intcampnew = bq10
recode intcampnew -1=2.5
replace intcampnew=(abs(intcampnew-4))/3
label variable intcampnew "campaing interest new"
label define campinterest 1 "1=high interest"
label values intcampnew campinterest
tab bq10 intcampnew
global keepers2010 $keepers2010 intcampnew

codebook bq58
gen attnpolsnew = bq58
recode attnpolsnew 98=5 99=.
replace attnpolsnew = attnpolsnew/10
tab attnpolsnew bq58
label variable attnpolsnew "attention to politics new"
label values attnpolsnew campinterest
tab bq58 attnpolsnew
global keepers2010 $keepers2010 attnpolsnew

codebook bq1
gen intpolsnew = bq1
recode intpolsnew -1=3
replace intpolsnew=(abs(intpolsnew-5))/4
label variable intpolsnew "interest in pols"
label define interest 1 "1=high interest"
label values intpolsnew interest
tab bq1 intpolsnew
global keepers2010 $keepers2010 intpolsnew

codebook bq53_5
gen donateptynew = bq53_5
replace donateptynew = donateptynew/10
tab donateptynew bq53_5
label variable donateptynew "likely to donate to party"
label define donate 1 "1=will donate"
label values donateptynew donate
tab bq53_5 donateptynew
global keepers2010 $keepers2010 donateptynew

gen ptymembnew = bq56_1
recode ptymembnew 1=1 2=0 -1=.5 -2=.
label variable ptymembnew "party membership new"
label define membr 1 "1=member"
label values ptymembnew membr
tab ptymembnew bq56_1
global keepers2010 $keepers2010 ptymembnew


// Media Exposure

codebook bq80_1
gen npexpnew = bq80_1
recode npexpnew 1=1 2=0 -1=.5 -2=.
label variable npexpnew "reads newspaper new"
label define reads 1 "1=reads np"
label values npexpnew reads
tab bq80_1 npexpnew
global keepers2010 $keepers2010 npexpnew

codebook bq83
gen netfollowtimeonlinenew = bq83
recode netfollowtimeonlinenew -1=3
gen flip = 6-netfollowtimeonlinenew
replace flip = (abs(flip-5))/4
tab flip bq83
replace netfollowtimeonlinenew = flip
drop flip
label variable netfollowtimeonlinenew "time spent using internet for news about pols" 
label define time 1 "1=lots of time following online"
label values netfollowtimeonlinenew time
tab  netfollowtimeonlinenew bq83
global keepers2010 $keepers2010 netfollowtimeonlinenew

gen watchdebatenew = bq85_1
recode watchdebatenew -1=.5 1=1 2=0
tab bq85_1 watchdebatenew
label variable watchdebatenew "watched one of debates new"
label define watch 1 "1=watched"
label values watchdebatenew watch
tab watchdebatenew bq85_1
global keepers2010 $keepers2010 watchdebatenew

codebook bq81
gen tvtimewatchnew = bq81
recode tvtimewatchnew -1=3 -2=.
gen flip = 6-tvtimewatchnew
replace flip = (abs(flip-5))/4
tab flip bq81
replace tvtimewatchnew = flip
drop flip
label variable tvtimewatchnew "time spent using tv for news about pols" 
label define times 1 "1=lots of time watching tv"
label values tvtimewatchnew times
tab  tvtimewatchnew bq81
global keepers2010 $keepers2010 tvtimewatchnew


// Ideology

codebook bq40_1
gen taxspendnew = bq40_1
replace taxspendnew=taxspendnew/10
label variable taxspendnew "social spending new"
label define spend 1 "1=pro-spending" 
label values taxspendnew spend
tab taxspendnew
tab bq40_1
global keepers2010 $keepers2010 taxspendnew



// Class/occupation

// Assuming that husband is "head of household"
*gen class_head_grade = 
*recode class_head_grade 0=.
label define LblClassOcc 1 "Prof. or higher technical" 2 "Manager or senior admin." 3 "Clerical" 4 "Sales or services" 5 "Small business owner" 6 "Foremen or supervisor" 7 "Skilled manual" 8 "Semi & unskilled manual" 9 "Other" 10 "Never worked"
*label values class_head_grade LblClassGrade
*global keepers2010 $keepers2010 class_head_grade

gen class_resp_occ = aq73_1
recode class_resp_occ -2=. -1=. 9=.
label values class_resp_occ LblClassOcc
global keepers2010 $keepers2010 class_resp_occ

gen class_spou_occ = aq73_2
recode class_spou_occ -2=. -1=. 9=.
label values class_spou_occ LblClassOcc
global keepers2010 $keepers2010 class_spou_occ

gen male = aq62
recode male 1=1 2=0
global keepers2010 $keepers2010 male

gen married = aq64
recode married 1=1 2=1 3=0 4=0 5=0 6=0 99=0 -2=. -1=.
global keepers2010 $keepers2010 married


gen unionmem_resp = zq94_1
recode unionmem_resp -2=. -1=. 1=1 2=1 3=0 6=.
global keepers2010 $keepers2010 unionmem_resp

gen unionmempast_resp = zq94_1
recode unionmempast_resp -2=. -1=. 1=1 2=1 3=0 6=.
global keepers2010 $keepers2010 unionmempast_resp



// Economic perceptions

gen econ_ego_retro = bq21
recode econ_ego_retro 1/2=0 3=1 4/5=2 -2 -1 8=.
global keepers2010 $keepers2010 econ_ego_retro
